package com.practise.rabbitmqdemo.controller;

import com.practise.rabbitmqdemo.entity.User;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;


@Slf4j
@RestController
@RequestMapping(value = "user")
@Api(value = "user controller", tags = {"用户信息接口"})
public class UserController {


//    @Autowired
//    TestGenService testGenService;

//    @ApiOperation() 用于方法；表示一个http请求的操作 value用于方法描述,notes用于提示内容, tags可以重新分组（视情况而用）


    @ApiOperation(value = "修改测试生成类信息", httpMethod = "POST")
    @RequestMapping(value = "update")
    public void update(@RequestBody @ApiParam(name = "User", value = "测试生成类", required = true) User user) {
        try {
            //  TODO 处理结果
//            Integer resultCount= testGenService.updateById(testGen);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
        return;
    }


    //    @ApiOperation() 用于方法；表示一个http请求的操作 value用于方法描述,notes用于提示内容, tags可以重新分组（视情况而用）
    //    paramType 三种值:query ,form ,body 分别对应 get ,form,json格式提交
    @RequestMapping(value = "delete", method = RequestMethod.GET)
    @ApiOperation(value = "删除测试生成类信息", httpMethod = "GET")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "测试生成类Id", required = false, paramType = "query"),
            @ApiImplicitParam(name = "name", value = "测试生成类名称", required = false, paramType = "query")
    })
    public void delete(Integer id, String name) {
        try {
            //  TODO 处理结果
//            Integer resultCount= testGenService.deleteById(id);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
        return;
    }

    @ApiOperation(value = "查询测试生成类信息", httpMethod = "POST")
    @RequestMapping(value = "findList", method = RequestMethod.POST, produces = "application/json;charset=utf-8")
    public void findList(@RequestBody @ApiParam(name = "User", value = "测试生成类", required = true) User user) {
        try {
            //  TODO 处理结果
//            List<TestGen> testGenList= testGenService.findList(testGen);
        } catch (Exception e) {
            log.error(e.getMessage(), e);
        }
        return;
    }

    @ApiOperation(value = "查询测试生成类信息", httpMethod = "GET")
    @RequestMapping(value = "findById/{id}")
    public void findById(@PathVariable @ApiParam(name = "id", value = "测试生成类 id", required = true) Integer id) throws Exception {
        /*try {
            //  TODO 处理结果
            TestGen testGen= testGenService.find(id);
        } catch (Exception e) {
            log.error(e.getMessage(),e);
        }
        return ;*/
        throw new Exception("test exception");
    }

}
